﻿using System;
using System.Collections.Generic;
using NUnit.Framework;
using Xenta.Enums;
using Xenta.Operations;

namespace Xenta.Tests.Operations
{
    [TestFixture]
    public class FileFolderTests : OperationTest
    {
        protected override IEnumerable<Type> ModelMappings
        {
            get
            {
                return NHMappings.ALL;
            }
        }

        [Test]
        public void Can_CRUD()
        {
            var folder = Processor.Execute(new CreateFileFolder
            {
                ParentID = 0
            }).Result;

            Assert.NotNull(folder);
            folder.AreEqual(Processor.Execute(new GetFileFolder
            {
                EntityID = folder.EntityID
            }).Result);

            var upd_folder = Processor.Execute(new UpdateFileFolder
            {
                EntityID = folder.EntityID,
                Flags = FileFolderFlags.Active
            }).Result;

            Assert.NotNull(upd_folder);
            upd_folder.AreEqual(folder);
            upd_folder.Flags.AreEqual(FileFolderFlags.Active);

            Processor.Execute(new DeleteFileFolder
            {
                EntityID = folder.EntityID
            });
        }
    }
}
